home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / programr / dpmigcc5.zip / RSX / SOURCE / FPU-EMU / FPU_ARIT.C < prev    next >
C/C++ Source or Header  |  1994-05-27  |  4KB  |  180 lines

  1. /*---------------------------------------------------------------------------+
  2.  |  fpu_arith.c                                                              |
  3.  |                                                                           |
  4.  | Code to implement the FPU register/register arithmetic instructions       |
  5.  |                                                                           |
  6.  | Copyright (C) 1992,1993                                                   |
  7.  |                       W. Metzenthen, 22 Parker St, Ormond, Vic 3163,      |
  8.  |                       Australia.  E-mail   billm@vaxc.cc.monash.edu.au    |
  9.  |                                                                           |
  10.  |                                                                           |
  11.  +---------------------------------------------------------------------------*/
  12.  
  13. #include "fpu_system.h"
  14. #include "fpu_emu.h"
  15. #include "control_w.h"
  16. #include "status_w.h"
  17.  
  18.  
  19. void fadd__()
  20. {
  21.   /* fadd st,st(i) */
  22.   clear_C1();
  23.   reg_add(FPU_st0_ptr, &st(FPU_rm), FPU_st0_ptr, control_word);
  24. }
  25.  
  26.  
  27. void fmul__()
  28. {
  29.   /* fmul st,st(i) */
  30.   clear_C1();
  31.   reg_mul(FPU_st0_ptr, &st(FPU_rm), FPU_st0_ptr, control_word);
  32. }
  33.  
  34.  
  35.  
  36. void fsub__()
  37. {
  38.   /* fsub st,st(i) */
  39.   clear_C1();
  40.   reg_sub(FPU_st0_ptr, &st(FPU_rm), FPU_st0_ptr, control_word);
  41. }
  42.  
  43.  
  44. void fsubr_()
  45. {
  46.   /* fsubr st,st(i) */
  47.   clear_C1();
  48.   reg_sub(&st(FPU_rm), FPU_st0_ptr, FPU_st0_ptr, control_word);
  49. }
  50.  
  51.  
  52. void fdiv__()
  53. {
  54.   /* fdiv st,st(i) */
  55.   clear_C1();
  56.   reg_div(FPU_st0_ptr, &st(FPU_rm), FPU_st0_ptr, control_word);
  57. }
  58.  
  59.  
  60. void fdivr_()
  61. {
  62.   /* fdivr st,st(i) */
  63.   clear_C1();
  64.   reg_div(&st(FPU_rm), FPU_st0_ptr, FPU_st0_ptr, control_word);
  65. }
  66.  
  67.  
  68.  
  69. void fadd_i()
  70. {
  71.   /* fadd st(i),st */
  72.   clear_C1();
  73.   reg_add(FPU_st0_ptr, &st(FPU_rm), &st(FPU_rm), control_word);
  74. }
  75.  
  76.  
  77. void fmul_i()
  78. {
  79.   /* fmul st(i),st */
  80.   clear_C1();
  81.   reg_mul(FPU_st0_ptr, &st(FPU_rm), &st(FPU_rm), control_word);
  82. }
  83.  
  84.  
  85. void fsubri()
  86. {
  87.   /* fsubr st(i),st */
  88.   /* This is the sense of the 80486 manual
  89.      reg_sub(&st(FPU_rm), FPU_st0_ptr, &st(FPU_rm), control_word); */
  90.   clear_C1();
  91.   reg_sub(FPU_st0_ptr, &st(FPU_rm), &st(FPU_rm), control_word);
  92. }
  93.  
  94.  
  95. void fsub_i()
  96. {
  97.   /* fsub st(i),st */
  98.   /* This is the sense of the 80486 manual
  99.      reg_sub(FPU_st0_ptr, &st(FPU_rm), &st(FPU_rm), control_word); */
  100.   clear_C1();
  101.   reg_sub(&st(FPU_rm), FPU_st0_ptr, &st(FPU_rm), control_word);
  102. }
  103.  
  104.  
  105. void fdivri()
  106. {
  107.   /* fdivr st(i),st */
  108.   clear_C1();
  109.   reg_div(FPU_st0_ptr, &st(FPU_rm), &st(FPU_rm), control_word);
  110. }
  111.  
  112.  
  113. void fdiv_i()
  114. {
  115.   /* fdiv st(i),st */
  116.   clear_C1();
  117.   reg_div(&st(FPU_rm), FPU_st0_ptr, &st(FPU_rm), control_word);
  118. }
  119.  
  120.  
  121.  
  122. void faddp_()
  123. {
  124.   /* faddp st(i),st */
  125.   clear_C1();
  126.   if ( !reg_add(FPU_st0_ptr, &st(FPU_rm), &st(FPU_rm), control_word) )
  127.     pop();
  128. }
  129.  
  130.  
  131. void fmulp_()
  132. {
  133.   /* fmulp st(i),st */
  134.   clear_C1();
  135.   if ( !reg_mul(FPU_st0_ptr, &st(FPU_rm), &st(FPU_rm), control_word) )
  136.     pop();
  137. }
  138.  
  139.  
  140.  
  141. void fsubrp()
  142. {
  143.   /* fsubrp st(i),st */
  144.   /* This is the sense of the 80486 manual
  145.      reg_sub(&st(FPU_rm), FPU_st0_ptr, &st(FPU_rm), control_word); */
  146.   clear_C1();
  147.   if ( !reg_sub(FPU_st0_ptr, &st(FPU_rm), &st(FPU_rm), control_word) )
  148.     pop();
  149. }
  150.  
  151.  
  152. void fsubp_()
  153. {
  154.   /* fsubp st(i),st */
  155.   /* This is the sense of the 80486 manual
  156.      reg_sub(FPU_st0_ptr, &st(FPU_rm), &st(FPU_rm), control_word); */
  157.   clear_C1();
  158.   if ( !reg_sub(&st(FPU_rm), FPU_st0_ptr, &st(FPU_rm), control_word) )
  159.     pop();
  160. }
  161.  
  162.  
  163. void fdivrp()
  164. {
  165.   /* fdivrp st(i),st */
  166.   clear_C1();
  167.   if ( !reg_div(FPU_st0_ptr, &st(FPU_rm), &st(FPU_rm), control_word) )
  168.     pop();
  169. }
  170.  
  171.  
  172. void fdivp_()
  173. {
  174.   /* fdivp st(i),st */
  175.   clear_C1();
  176.   if ( !reg_div(&st(FPU_rm), FPU_st0_ptr, &st(FPU_rm), control_word) )
  177.     pop();
  178. }
  179.  
  180.